//
//  CategoryDropView.m
//  小团购
//
//  Created by 樊荣海 on 15/1/23.
//  Copyright (c) 2015年 樊荣海. All rights reserved.
//

#import "CategoryDropView.h"

@implementation CategoryDropView {
    
    CateView *_cateView;
}

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self == [super initWithFrame:frame]) {
        
        //1.往scrollView里面添加东西
        NSMutableArray *tempArray = [NSMutableArray array];
        
        CateModel *model = [[CateModel alloc] init];
        model.icon = @"ic_filter_category_-1";
        model.name = @"全部分类";
        
        [tempArray addObject:model];
        [tempArray addObjectsFromArray: [MetaDataTool sharedMetaDataTool].totalCategories];
        
        for (int i = 0; i < tempArray.count; i++) {
            
            CateModel *model = tempArray[i];
            
            CateDropBtn *btn = [[CateDropBtn alloc] initWithFrame:CGRectMake(5+DropScrollViewW*i, 0, DropScrollViewW, DropScrollViewH)];
            btn.model = model;
            [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];

            [self.scrollView addSubview:btn];
           
//            if (i==0) {
//                btn.selected = YES;
//                self.currentBtn = btn;
//            }
            
        }
        
        self.scrollView.contentSize = CGSizeMake(DropScrollViewW*tempArray.count + 10, DropScrollViewH);
        
    }
    
    return self;
    
}

- (void)hideAniamtion {
    
    [super hideAniamtion];
    
    [_cateView hideAniamtion];
}












@end